Nuxt/2/Convert Nuxt.Js Config To The `DefineNuxtConfig`

/icons/calendar.svg

Last update

Aug 30, 2024

Convert Nuxt.js Config to defineNuxtConfig

This codemod helps you migrate your Nuxt.js configuration files to use the new defineNuxtConfig format. This is useful when updating to a newer version of Nuxt.js that supports this method for defining configuration.

The codemod transforms the existing export default Nuxt.js configuration objects into the defineNuxtConfig function call. This standardizes the configuration format and ensures compatibility with the latest Nuxt.js features.

Example Transformations

Below are some examples demonstrating how the codemod transforms the configuration:

Example 1

Before:

export default {
// ...
};

After

export default defineNuxtConfig({
// ...
});

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now